package com.ricky02.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * 判断是否是utf8字符集
 */
public class UTF8Conditon implements Condition{
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        String encoding=System.getProperty("file.encoding");
        if (encoding!=null) {
            return "utf-8".equals(encoding.toLowerCase());
        }
        return false;
    }
}
